#@layout()

#define content()

<div class="easyui-layout" data-options="fit:true">
    <div data-options="region:'west',border:true,width:'50%'" title="源数据库">
        <table class="table table-bordered">
            <tr>
                <td>数据库类型：</td>
                <td>
                    <select name="sourceDatabaseType" id="sourceDatabaseType" class="easyui-combobox">
                        <option value="db2">db2</option>
                        <option value="oracle">oracle</option>
                        <option value="mysql">mysql</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>地址：</td>
                <td><input type="text" class="easyui-textbox" id="sourceHost" name="sourceHost"></td>
            </tr>
            <tr>
                <td>端口：</td>
                <td><input type="text" class="easyui-numberbox" id="sourcePort" name="sourcePort"></td>
            </tr>
            <tr>
                <td>数据库名称：</td>
                <td><input type="text" class="easyui-textbox" id="sourceDatabaseName" name="sourceDatabaseName"></td>
            </tr>
            <tr>
                <td>用户名：</td>
                <td><input type="text" class="easyui-textbox" id="sourceUsername" name="sourceUsername"></td>
            </tr>
            <tr>
                <td>密码：</td>
                <td><input type="text" class="easyui-passwordbox" id="sourcePassword" name="sourcePassword"></td>
            </tr>
        </table>
    </div>
    <div data-options="region:'center',border:true" title="目标数据库">
        <table class="table table-bordered">
            <tr>
                <td>数据库类型：</td>
                <td>
                    <select name="targetDatabaseType" id="targetDatabaseType" class="easyui-combobox">
                        <option value="db2">db2</option>
                        <option value="oracle">oracle</option>
                        <option value="mysql">mysql</option>
                    </select>
                </td>
            </tr>
            <tr>
                <td>地址：</td>
                <td><input type="text" class="easyui-textbox" id="targetHost" name="targetHost"></td>
            </tr>
            <tr>
                <td>端口：</td>
                <td><input type="text" class="easyui-numberbox" id="targetPort" name="targetPort"></td>
            </tr>
            <tr>
                <td>数据库名称：</td>
                <td><input type="text" class="easyui-textbox" id="targetDatabaseName" name="targetDatabaseName"></td>
            </tr>
            <tr>
                <td>用户名：</td>
                <td><input type="text" class="easyui-textbox" id="targetUsername" name="targetUsername"></td>
            </tr>
            <tr>
                <td>密码：</td>
                <td><input type="text" class="easyui-passwordbox" id="targetPassword" name="targetPassword"></td>
            </tr>
        </table>
    </div>

    <div data-options="region:'south',border:true,height:'500px'" title="结果">
        <button class="easyui-button" onclick="compareDatabase()">对比数据库</button>
    </div>
</div>

#end


#define css()

#end


#define js()

<script type="text/javascript">
    function compareDatabase() {
        var sourceDatabaseType = $("#sourceDatabaseType");
        var sourceHost = $("#sourceHost");
        var sourcePort = $("#sourcePort");
        var sourceDatabaseName = $("#sourceDatabaseName");
        var sourceUsername = $("#sourceUsername");
        var sourcePassword = $("#sourcePassword");

        var targetDatabaseType = $("#targetDatabaseType");
        var targetHost = $("#targetHost");
        var targetPort = $("#targetPort");
        var targetDatabaseName = $("#targetDatabaseName");
        var targetUsername = $("#targetUsername");
        var targetPassword = $("#targetPassword");

        var params = {};
        params.sourceDatabaseType = sourceDatabaseType.val();
        params.sourceHost = sourceHost.val();
        params.sourcePort = sourcePort.val();
        params.sourcePort = sourcePort.val();
        params.sourceDatabaseName = sourceDatabaseName.val();
        params.sourceUsername = sourceUsername.val();
        params.sourcePassword = sourcePassword.val();

        params.targetDatabaseType = targetDatabaseType.val();
        params.targetHost = targetHost.val();
        params.targetPort = targetPort.val();
        params.targetPort = targetPort.val();
        params.targetDatabaseName = targetDatabaseName.val();
        params.targetUsername = targetUsername.val();
        params.targetPassword = targetPassword.val();


        $.post(contextRootPath + '/kcdb/compareDatabase', params, function (res) {
            console.log(res);
        });


    }
</script>

#end



